﻿#ifndef DEALEXCELFILE_H
#define DEALEXCELFILE_H

#include <QObject>
#include "excelengine.h"
#include "judgeFileAndDeal.h"

#include <QTableWidget>
#include <QPaintEvent>
#include <QResizeEvent>

#include <QSqlTableModel>
#include <QTableView>
#include <QEvent>
#include <QMutex>
#include <QMutexLocker>
class DealExcelFile : public QObject
{
    Q_OBJECT
public:
    explicit DealExcelFile(QObject *parent = 0);
    ~DealExcelFile();
    void createTable(int row,int col);//Excel创建空表
    bool createTree(int row,int col,QTreeWidget* tree);
    void SetPointStatue(const QString ip,const int statue);
    //void SetIPAndStatue(const QString ip,const int statue);
    bool GetIPByItem(QTreeWidgetItem* item,QString &ip);
    bool GetNameByIP(const QString ip, QString &name, QString &firstName);
    void Close();
    void Init();
signals:
    
public slots:

public:
    bool    IsXlsFile;
    bool    IsDbFile;

    multideal       *sqlite;
    QSqlTableModel  *model;
    QTableView      *tableview;

    QString         file_name;
    QString         databaseTable;
private:
    bool        xlsOpenFlag;
    bool        dbOpenFlag;
    bool        hasExistFile;//当前有打开的文件
    bool m_bOpenSuccess;
    ExcelEngine  *excelFile;
    QTableWidget *excelTable;
    QTreeWidget *excelTree;
    bool OpenExcelFile();
    QMutex m_mutex;
};
DealExcelFile* getDealExecl();
#endif // DEALEXCELFILE_H
